<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: SimplePathlossModel Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00199.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#friends">Friends</a>  </div>
  <div class="headertitle">
<div class="title">SimplePathlossModel Class Reference<div class="ingroups"><a class="el" href="a00511.html">analogueModels - AnalogueModel implementations</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="SimplePathlossModel" --><!-- doxytag: inherits="AnalogueModel" -->
<p>Basic implementation of a <a class="el" href="a00199.html" title="Basic implementation of a SimplePathlossModel that uses SimplePathlossConstMapping (that is subclasse...">SimplePathlossModel</a> that uses <a class="el" href="a00198.html" title="Mapping that represents a Pathloss-function.">SimplePathlossConstMapping</a> (that is subclassed from <a class="el" href="a00194.html" title="Abstract subclass of ConstMapping which can be used as base for any ConstMapping implementation with ...">SimpleConstMapping</a>) as attenuation-Mapping.  
 <a href="a00199.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00404_source.html">SimplePathlossModel.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for SimplePathlossModel:</div>
<div class="dyncontent">
<div class="center"><img src="a01015.png" border="0" usemap="#SimplePathlossModel_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for SimplePathlossModel:</div>
<div class="dyncontent">
<div class="center"><img src="a01016.png" border="0" usemap="#SimplePathlossModel_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a01017.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#aedf82487a8fd5d18d251cd357b431d2a">SimplePathlossModel</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the analogue model. playgroundSize need to be valid as long as this instance exists.  <a href="#aedf82487a8fd5d18d251cd357b431d2a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#a51b4be0210555212a92f0400fa4393d9">initFromMap</a> (const <a class="el" href="a00009.html#ab1820eb5285a02a2464be54ec651feab">ParameterMap</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the analog model from XML map data.  <a href="#a51b4be0210555212a92f0400fa4393d9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#a7a1a3a2080c5cf5d7ac3550f33099508">filterSignal</a> (airframe_ptr_t, const <a class="el" href="a00065.html">Coord</a> &amp;, const <a class="el" href="a00065.html">Coord</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Filters a specified AirFrame's <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> by adding an attenuation over time to the <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>.  <a href="#a7a1a3a2080c5cf5d7ac3550f33099508"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#ade7562b60b0a5ced0d81ca29bee99ffd">calcPathloss</a> (const <a class="el" href="a00065.html">Coord</a> &amp;receiverPos, const <a class="el" href="a00065.html">Coord</a> &amp;sendersPos)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Method to calculate the attenuation value for pathloss.  <a href="#ade7562b60b0a5ced0d81ca29bee99ffd"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a064c70c5c35a1bcb1d6450722d70ec1d"></a><!-- doxytag: member="SimplePathlossModel::pathLossAlphaHalf" ref="a064c70c5c35a1bcb1d6450722d70ec1d" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#a064c70c5c35a1bcb1d6450722d70ec1d">pathLossAlphaHalf</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Path loss coefficient. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a48902a15501db259c953348f4d50313a"></a><!-- doxytag: member="SimplePathlossModel::carrierFrequency" ref="a48902a15501db259c953348f4d50313a" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#a48902a15501db259c953348f4d50313a">carrierFrequency</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">carrier frequency needed for calculation <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abadf2a2885c8e8597713a7d14201d732"></a><!-- doxytag: member="SimplePathlossModel::useTorus" ref="abadf2a2885c8e8597713a7d14201d732" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#abadf2a2885c8e8597713a7d14201d732">useTorus</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Information needed about the playground. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad42603e06762d9ccafdc2ef39ec8552d"></a><!-- doxytag: member="SimplePathlossModel::playgroundSize" ref="ad42603e06762d9ccafdc2ef39ec8552d" args="" -->
<a class="el" href="a00065.html">Coord</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d">playgroundSize</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The size of the playground. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a659b7135ed6ca2282617b863362f21f4"></a><!-- doxytag: member="SimplePathlossModel::debug" ref="a659b7135ed6ca2282617b863362f21f4" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00199.html#a659b7135ed6ca2282617b863362f21f4">debug</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Whether debug messages should be displayed. <br/></td></tr>
<tr><td colspan="2"><h2><a name="friends"></a>
Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a917f0958441d102331b9adf788fd63c8"></a><!-- doxytag: member="SimplePathlossModel::SimplePathlossConstMapping" ref="a917f0958441d102331b9adf788fd63c8" args="" -->
class&#160;</td><td class="memItemRight" valign="bottom"><b>SimplePathlossConstMapping</b></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Basic implementation of a <a class="el" href="a00199.html" title="Basic implementation of a SimplePathlossModel that uses SimplePathlossConstMapping (that is subclasse...">SimplePathlossModel</a> that uses <a class="el" href="a00198.html" title="Mapping that represents a Pathloss-function.">SimplePathlossConstMapping</a> (that is subclassed from <a class="el" href="a00194.html" title="Abstract subclass of ConstMapping which can be used as base for any ConstMapping implementation with ...">SimpleConstMapping</a>) as attenuation-Mapping. </p>
<p>An example config.xml for this <a class="el" href="a00009.html" title="Interface for the analogue models of the physical layer.">AnalogueModel</a> can be the following: </p>
<div class="fragment"><pre class="fragment">
	&lt;AnalogueModel type="SimplePathlossModel"&gt;
		&lt;!-- Environment parameter of the pathloss formula
			 If ommited default value is 3.5--&gt;
		&lt;parameter name="alpha" type="double" value="3.5"/&gt;

		&lt;!-- Carrier frequency of the signal in Hz
			 If ommited the carrier frequency from the
			 connection manager is taken if available
			 otherwise set to default frequency of 2.412e+9--&gt;
		&lt;parameter name="carrierFrequency" type="double" value="2.412e+9"/&gt;
	&lt;/AnalogueModel&gt;
   </pre></div> </div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="aedf82487a8fd5d18d251cd357b431d2a"></a><!-- doxytag: member="SimplePathlossModel::SimplePathlossModel" ref="aedf82487a8fd5d18d251cd357b431d2a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SimplePathlossModel::SimplePathlossModel </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initializes the analogue model. playgroundSize need to be valid as long as this instance exists. </p>
<p>The constructor needs some specific knowledge in order to create its mapping properly:</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">alpha</td><td>the coefficient alpha (specified e.g. in config.xml and passed in constructor call) </td></tr>
    <tr><td class="paramname">carrierFrequency</td><td>the carrier frequency </td></tr>
    <tr><td class="paramname">useTorus</td><td>information about the playground the host is moving in </td></tr>
    <tr><td class="paramname">playgroundSize</td><td>information about the playground the host is moving in </td></tr>
    <tr><td class="paramname">debug</td><td>display debug messages? </td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment">      : <a class="code" href="a00199.html#a064c70c5c35a1bcb1d6450722d70ec1d" title="Path loss coefficient.">pathLossAlphaHalf</a>(0)
      , <a class="code" href="a00199.html#a48902a15501db259c953348f4d50313a" title="carrier frequency needed for calculation">carrierFrequency</a>(0)
      , <a class="code" href="a00199.html#abadf2a2885c8e8597713a7d14201d732" title="Information needed about the playground.">useTorus</a>(<span class="keyword">false</span>)
      , <a class="code" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d" title="The size of the playground.">playgroundSize</a>()
      , <a class="code" href="a00199.html#a659b7135ed6ca2282617b863362f21f4" title="Whether debug messages should be displayed.">debug</a>(<span class="keyword">false</span>)
  { }
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ade7562b60b0a5ced0d81ca29bee99ffd"></a><!-- doxytag: member="SimplePathlossModel::calcPathloss" ref="ade7562b60b0a5ced0d81ca29bee99ffd" args="(const Coord &amp;receiverPos, const Coord &amp;sendersPos)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double SimplePathlossModel::calcPathloss </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> &amp;&#160;</td>
          <td class="paramname"><em>receiverPos</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> &amp;&#160;</td>
          <td class="paramname"><em>sendersPos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Method to calculate the attenuation value for pathloss. </p>
<p>Functionality is similar to pathloss-calculation in BasicSnrEval from Mobility-frame work.</p>
<p>Note: This method is not used directly anymore. Instead the actual pathloss is calculated in SimplePathlossConstMappings "getValue()" method. </p>

<p>References <a class="el" href="a00199.html#a48902a15501db259c953348f4d50313a">carrierFrequency</a>, <a class="el" href="a00199.html#a064c70c5c35a1bcb1d6450722d70ec1d">pathLossAlphaHalf</a>, <a class="el" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d">playgroundSize</a>, <a class="el" href="a00030.html#a84d040f815027b3098451b02733ac63d">BaseWorldUtility::speedOfLight</a>, <a class="el" href="a00065.html#a9245e5acb794d95128e191e6faef99d4">Coord::sqrdist()</a>, <a class="el" href="a00065.html#aaf6119bf8bc9953d561729314de8ed5e">Coord::sqrTorusDist()</a>, and <a class="el" href="a00199.html#abadf2a2885c8e8597713a7d14201d732">useTorus</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="comment">/*</span>
<span class="comment">   * maybe we can reuse an already calculated value for the square-distance</span>
<span class="comment">   * at this point.</span>
<span class="comment">   *</span>
<span class="comment">   */</span>
  <span class="keywordtype">double</span> sqrdistance = 0.0;

  <span class="keywordflow">if</span> (<a class="code" href="a00199.html#abadf2a2885c8e8597713a7d14201d732" title="Information needed about the playground.">useTorus</a>)
  {
    sqrdistance = receiverPos.<a class="code" href="a00065.html#aaf6119bf8bc9953d561729314de8ed5e" title="Returns the squared distance on a torus of this to Coord &#39;b&#39; (omits calling square root)...">sqrTorusDist</a>(sendersPos, <a class="code" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d" title="The size of the playground.">playgroundSize</a>);
  } <span class="keywordflow">else</span>
  {
    sqrdistance = receiverPos.<a class="code" href="a00065.html#a9245e5acb794d95128e191e6faef99d4" title="Returns distance^2 to Coord &#39;a&#39; (omits calling square root).">sqrdist</a>(sendersPos);
  }

  splmEV &lt;&lt; <span class="stringliteral">&quot;sqrdistance is: &quot;</span> &lt;&lt; sqrdistance &lt;&lt; endl;

  <span class="keywordtype">double</span> attenuation = 1.0;
  <span class="comment">// wavelength in metres</span>
  <span class="keywordtype">double</span> wavelength = (<a class="code" href="a00030.html#a84d040f815027b3098451b02733ac63d" title="Speed of light in meters per second.">BaseWorldUtility::speedOfLight</a>/<a class="code" href="a00199.html#a48902a15501db259c953348f4d50313a" title="carrier frequency needed for calculation">carrierFrequency</a>);

  splmEV &lt;&lt; <span class="stringliteral">&quot;wavelength is: &quot;</span> &lt;&lt; wavelength &lt;&lt; endl;

  <span class="keywordflow">if</span> (sqrdistance &gt; 1.0)
  {
    attenuation = (wavelength * wavelength) / (16.0 * M_PI * M_PI)
            * (pow(sqrdistance, -1.0*<a class="code" href="a00199.html#a064c70c5c35a1bcb1d6450722d70ec1d" title="Path loss coefficient.">pathLossAlphaHalf</a>));
  }

  splmEV &lt;&lt; <span class="stringliteral">&quot;attenuation is: &quot;</span> &lt;&lt; attenuation &lt;&lt; endl;

  <span class="keywordflow">return</span> attenuation;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a7a1a3a2080c5cf5d7ac3550f33099508"></a><!-- doxytag: member="SimplePathlossModel::filterSignal" ref="a7a1a3a2080c5cf5d7ac3550f33099508" args="(airframe_ptr_t, const Coord &amp;, const Coord &amp;)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SimplePathlossModel::filterSignal </td>
          <td>(</td>
          <td class="paramtype">airframe_ptr_t&#160;</td>
          <td class="paramname"><em>frame</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> &amp;&#160;</td>
          <td class="paramname"><em>sendersPos</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> &amp;&#160;</td>
          <td class="paramname"><em>receiverPos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Filters a specified AirFrame's <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> by adding an attenuation over time to the <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>. </p>
<p>Calculate the distance factor </p>

<p>Implements <a class="el" href="a00009.html#a3242bc36a68dab53551d4ab1f1dab010">AnalogueModel</a>.</p>

<p>References <a class="el" href="a00192.html#a0beeef0f27c33145a0fca521df1c5f5c">Signal::addAttenuation()</a>, <a class="el" href="a00199.html#a48902a15501db259c953348f4d50313a">carrierFrequency</a>, <a class="el" href="a00085.html#ad4360e7d88c881d06ee61033ad99d66f">Dimension::frequency</a>, <a class="el" href="a00058.html#acc1559cf5741bec3aa6422e94c5b9cce">ConstMapping::getDimensionSet()</a>, <a class="el" href="a00192.html#a392ecf1a624edfb90243e7227370a772">Signal::getTransmissionPower()</a>, <a class="el" href="a00086.html#a015cb6fa6c77b26b8c7b1e65827b8342">DimensionSet::hasDimension()</a>, <a class="el" href="a00199.html#a064c70c5c35a1bcb1d6450722d70ec1d">pathLossAlphaHalf</a>, <a class="el" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d">playgroundSize</a>, <a class="el" href="a00030.html#a84d040f815027b3098451b02733ac63d">BaseWorldUtility::speedOfLight</a>, <a class="el" href="a00065.html#a9245e5acb794d95128e191e6faef99d4">Coord::sqrdist()</a>, <a class="el" href="a00065.html#aaf6119bf8bc9953d561729314de8ed5e">Coord::sqrTorusDist()</a>, <a class="el" href="a00086.html#abf3b99a319deca6efc123ec52d77d867">DimensionSet::timeDomain</a>, <a class="el" href="a00086.html#ac3f34a560d6c4ad5dc8d72dc69359b77">DimensionSet::timeFreqDomain</a>, and <a class="el" href="a00199.html#abadf2a2885c8e8597713a7d14201d732">useTorus</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>&amp; signal = frame-&gt;getSignal();

  <span class="keywordtype">double</span> sqrDistance = <a class="code" href="a00199.html#abadf2a2885c8e8597713a7d14201d732" title="Information needed about the playground.">useTorus</a> ? receiverPos.<a class="code" href="a00065.html#aaf6119bf8bc9953d561729314de8ed5e" title="Returns the squared distance on a torus of this to Coord &#39;b&#39; (omits calling square root)...">sqrTorusDist</a>(sendersPos, <a class="code" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d" title="The size of the playground.">playgroundSize</a>)
                  : receiverPos.<a class="code" href="a00065.html#a9245e5acb794d95128e191e6faef99d4" title="Returns distance^2 to Coord &#39;a&#39; (omits calling square root).">sqrdist</a>(sendersPos);

  splmEV &lt;&lt; <span class="stringliteral">&quot;sqrdistance is: &quot;</span> &lt;&lt; sqrDistance &lt;&lt; endl;

  <span class="keywordflow">if</span>(sqrDistance &lt;= 1.0) {
    <span class="comment">//attenuation is negligible</span>
    <span class="keywordflow">return</span>;
  }

  <span class="comment">// wavelength in meters (this is only used for debug purposes here</span>
  <span class="comment">// the actual effect of the wavelength on the attenuation is</span>
  <span class="comment">// calculated in SimplePathlossConstMappings &quot;getValue()&quot; method).</span>
  <span class="keywordtype">double</span> wavelength = (<a class="code" href="a00030.html#a84d040f815027b3098451b02733ac63d" title="Speed of light in meters per second.">BaseWorldUtility::speedOfLight</a>/<a class="code" href="a00199.html#a48902a15501db259c953348f4d50313a" title="carrier frequency needed for calculation">carrierFrequency</a>);
  splmEV &lt;&lt; <span class="stringliteral">&quot;wavelength is: &quot;</span> &lt;&lt; wavelength &lt;&lt; endl;

  <span class="comment">// the part of the attenuation only depending on the distance</span>
  <span class="keywordtype">double</span> distFactor = pow(sqrDistance, -<a class="code" href="a00199.html#a064c70c5c35a1bcb1d6450722d70ec1d" title="Path loss coefficient.">pathLossAlphaHalf</a>) / (16.0 * M_PI * M_PI);
  splmEV &lt;&lt; <span class="stringliteral">&quot;distance factor is: &quot;</span> &lt;&lt; distFactor &lt;&lt; endl;

  <span class="comment">//is our signal to attenuate defined over frequency?</span>
  <span class="keywordtype">bool</span> hasFrequency = signal.<a class="code" href="a00192.html#a392ecf1a624edfb90243e7227370a772" title="Returns the function representing the transmission power of the signal.">getTransmissionPower</a>()-&gt;<a class="code" href="a00058.html#acc1559cf5741bec3aa6422e94c5b9cce" title="Returns this Mappings domain as DimensionSet.">getDimensionSet</a>().<a class="code" href="a00086.html#a015cb6fa6c77b26b8c7b1e65827b8342" title="Returns true if the passed Dimension is inside this DimensionSet.">hasDimension</a>(<a class="code" href="a00085.html#ad4360e7d88c881d06ee61033ad99d66f" title="Shortcut to the frequency Dimension, same as &#39;Dimension(&quot;frequency&quot;)&#39;, but spares the parsing of a ...">Dimension::frequency</a>);
  splmEV &lt;&lt; <span class="stringliteral">&quot;Signal contains frequency dimension: &quot;</span> &lt;&lt; (hasFrequency ? <span class="stringliteral">&quot;yes&quot;</span> : <span class="stringliteral">&quot;no&quot;</span>) &lt;&lt; endl;

  <span class="keyword">const</span> <a class="code" href="a00086.html" title="Represents a set of dimensions which is used to define over which dimensions a mapping is defined (th...">DimensionSet</a>&amp; domain = hasFrequency ? <a class="code" href="a00086.html#ac3f34a560d6c4ad5dc8d72dc69359b77" title="Shortcut to a DimensionSet which contains time and frequency.">DimensionSet::timeFreqDomain</a> : <a class="code" href="a00086.html#abf3b99a319deca6efc123ec52d77d867" title="Shortcut to a DimensionSet which only contains time.">DimensionSet::timeDomain</a>;

  <span class="comment">//create the Attenuation mapping which takes the distance factor as parameter</span>
  <span class="comment">//to calculate the attenuation from this and the frequency used for the transmission</span>
  <span class="comment">//see the classes &quot;getValue()&quot; for more</span>
  <a class="code" href="a00198.html" title="Mapping that represents a Pathloss-function.">SimplePathlossConstMapping</a>* attMapping = <span class="keyword">new</span> <a class="code" href="a00198.html" title="Mapping that represents a Pathloss-function.">SimplePathlossConstMapping</a>(
                          domain,
                          <span class="keyword">this</span>,
                          distFactor);

  <span class="comment">/* at last add the created attenuation mapping to the signal */</span>
  signal.<a class="code" href="a00192.html#a0beeef0f27c33145a0fca521df1c5f5c" title="Adds a function representing an attenuation of the signal.">addAttenuation</a>(attMapping);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a51b4be0210555212a92f0400fa4393d9"></a><!-- doxytag: member="SimplePathlossModel::initFromMap" ref="a51b4be0210555212a92f0400fa4393d9" args="(const ParameterMap &amp;)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool SimplePathlossModel::initFromMap </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00009.html#ab1820eb5285a02a2464be54ec651feab">ParameterMap</a> &amp;&#160;</td>
          <td class="paramname"><em>params</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialize the analog model from XML map data. </p>
<p>This method should be defined for generic analog model initialization.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">params</td><td>The parameter map which was filled by XML reader.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the initialization was successfully. </dd></dl>

<p>Reimplemented from <a class="el" href="a00009.html#a9c52493cdf1baa4110a83869e8bc13c5">AnalogueModel</a>.</p>

<p>References <a class="el" href="a00199.html#a48902a15501db259c953348f4d50313a">carrierFrequency</a>, <a class="el" href="a00199.html#a659b7135ed6ca2282617b863362f21f4">debug</a>, <a class="el" href="a00199.html#a064c70c5c35a1bcb1d6450722d70ec1d">pathLossAlphaHalf</a>, <a class="el" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d">playgroundSize</a>, and <a class="el" href="a00199.html#abadf2a2885c8e8597713a7d14201d732">useTorus</a>.</p>
<div class="fragment"><pre class="fragment">                                                                {
    ParameterMap::const_iterator it;
    <span class="keywordtype">bool</span>                         bInitSuccess = <span class="keyword">true</span>;

    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;seed&quot;</span>)) != params.end()) {
        srand( ParameterMap::mapped_type(it-&gt;second).longValue() );
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;alpha&quot;</span>)) != params.end()) {
        <a class="code" href="a00199.html#a064c70c5c35a1bcb1d6450722d70ec1d" title="Path loss coefficient.">pathLossAlphaHalf</a> = ParameterMap::mapped_type(it-&gt;second).doubleValue() * .5;
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No alpha defined in config.xml for SimplePathlossModel!&quot;</span>);
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;useTorus&quot;</span>)) != params.end()) {
        <a class="code" href="a00199.html#abadf2a2885c8e8597713a7d14201d732" title="Information needed about the playground.">useTorus</a> = ParameterMap::mapped_type(it-&gt;second).boolValue();
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No useTorus defined in config.xml for SimplePathlossModel!&quot;</span>);
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;PgsX&quot;</span>)) != params.end()) {
        <a class="code" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d" title="The size of the playground.">playgroundSize</a>.x = ParameterMap::mapped_type(it-&gt;second).doubleValue();
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No PgsX defined in config.xml for SimplePathlossModel!&quot;</span>);
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;PgsY&quot;</span>)) != params.end()) {
        <a class="code" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d" title="The size of the playground.">playgroundSize</a>.y = ParameterMap::mapped_type(it-&gt;second).doubleValue();
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No PgsY defined in config.xml for SimplePathlossModel!&quot;</span>);
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;PgsZ&quot;</span>)) != params.end()) {
        <a class="code" href="a00199.html#ad42603e06762d9ccafdc2ef39ec8552d" title="The size of the playground.">playgroundSize</a>.z = ParameterMap::mapped_type(it-&gt;second).doubleValue();
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No PgsZ defined in config.xml for SimplePathlossModel!&quot;</span>);
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;debug&quot;</span>)) != params.end()) {
        <a class="code" href="a00199.html#a659b7135ed6ca2282617b863362f21f4" title="Whether debug messages should be displayed.">debug</a> = ParameterMap::mapped_type(it-&gt;second).boolValue();
    }
    <span class="keywordflow">else</span> {
        <a class="code" href="a00199.html#a659b7135ed6ca2282617b863362f21f4" title="Whether debug messages should be displayed.">debug</a> = <span class="keyword">false</span>;
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;carrierFrequency&quot;</span>)) != params.end()) {
        <a class="code" href="a00199.html#a48902a15501db259c953348f4d50313a" title="carrier frequency needed for calculation">carrierFrequency</a> = ParameterMap::mapped_type(it-&gt;second).doubleValue();
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No carrierFrequency defined in config.xml for SimplePathlossModel!&quot;</span>);
    }

    <span class="keywordflow">return</span> <a class="code" href="a00199.html#a51b4be0210555212a92f0400fa4393d9" title="Initialize the analog model from XML map data.">AnalogueModel::initFromMap</a>(params) &amp;&amp; bInitSuccess;
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/analogueModel/<a class="el" href="a00404_source.html">SimplePathlossModel.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/analogueModel/SimplePathlossModel.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00199.html">SimplePathlossModel</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:33 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
